package com.bestcem.xm.wallet.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.stream.Stream;

/**
 * 冻结类型
 *
 * @author panyun <yun.pan@idiaoyan.com>
 * @date 2022/5/12 15:32
 */
@Getter
@NoArgsConstructor
@AllArgsConstructor
public enum FreezeTypeEnum {
    /**
     * 冻结类型枚举
     */
    UNSPECIFIED(0, "未指定"),
    RED_PACKET(1, "红包冻结"),
    SMS(2, "短信冻结");

    private Integer type;
    private String detail;

    /**
     * 根据冻结类型获取冻结枚举内容
     *
     * @param type 冻结类型
     * @return com.bestcem.xm.wallet.enums.FreezeTypeEnum
     * @author panyun <yun.pan@idiaoyan.com>
     * @date 2022/5/12 15:35
     */
    public static FreezeTypeEnum getByType(Integer type) {
        return Stream.of(values()).filter(t -> t.getType().equals(type)).findFirst().orElse(null);
    }
}
